<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
use Facades\App\Service\Weibo;

//Event::listen('eloquent.created: App\Post', function (){
//    dd('A post created');
//});
//
Route::get('/', function (){
    \App\Post::create(['title' => 'Title', 'body' => 'content']);
});



Route::get('/facades', function (){
    Weibo::publish('这个一条微博状态');
});

Route::prefix('admin')->middleware('auth')->name('dashboard')->get('/', function () {
    return view('welcome');
});
//Route::get('/' , function(){
//    // 实例化这个 markdown 格式的邮件类
//    $email = new \App\Mail\OrderShipped(\App\User::first());
//    //dd($email);   得到一个 OrderShipped 实例
//    Mail::to(\App\User::first())->send($email);  // 执行发送
//
//});

Route::resource('posts', 'PostController');

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');
